import { createStore, applyMiddleware } from 'redux'
import reducer from './reducers';

import thunk from 'redux-thunk';


// 中间为一个函数
const enhancer = applyMiddleware(thunk)
const store = createStore(reducer, enhancer);

// 监听操作
store.subscribe(() => {
  // 这里的代码在State被修改后执行
  console.log('subscribe', store.getState())
})

// 操作获取
const data = store.getState();
console.log('store.getState=', data);

export default store